<template>
  <div>
    <el-table :data="seckillList" style="width: 100%">
      <el-table-column prop="title" label="活动名称" width="180"> </el-table-column>
       <el-table-column label="状态">
        <template slot-scope="scope">
          <div>
            <el-button type="primary" v-if="scope.row.status == 1"
              >启 用</el-button
            >
            <el-button type="success" v-else>禁 用</el-button>
          </div>
        </template>
      </el-table-column>
        <el-table-column label="操作">
        <template slot-scope="scope">
          <div>
            <el-button type="info" @click="edit(scope.row.id)">编 辑</el-button>
             <v-del @del="del(scope.row.id)"></v-del>
          </div>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
import { seckillDel } from "../../../request/api";
import { successAlert, warningAlert } from "../../../utils/alert";
export default {
  props: [],
  components: {},
  data() {
    return {
    };
  },
  computed: {
    ...mapGetters({
        seckillList:"seckill/list",
        cateList:"cate/list"
    }),
  },
  methods: {
    ...mapActions({
        asyncseckillList:"seckill/asyncList",
        // asyncCateLIist:"cate/asynclist",
    }),
       edit(id) {
      // 通知父组件，我点了编辑
      this.$emit("edit", id);
    },
     del(id) {
      seckillDel({ id: id }).then((res) => {
        if (res.data.code == 200) {
          // 成功的提示窗
          successAlert(res.data.msg);
          // 刷新列表数据
          this.asyncseckillList()
          // this.asyncCateLIist()
        } else {
          // 失败的提示窗
          warningAlert(res.data.msg);
        }
      });
    },
 
  },
  mounted() {
     
  },
};
</script>
<style scoped>
</style>